package com.ruoyi.api.controller;

import com.ruoyi.api.domain.CourierCompany;
import com.ruoyi.api.service.ICourierCompanyService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 寻觅
 * @since 2025-06-13
 */
@RestController
@RequestMapping("courier/company")
public class CourierCompanyController {
    @Autowired
    ICourierCompanyService iCourierCompanyService;

    /**
     * 查询快递公司列表
     * @return
     */
    @GetMapping("list")
    public AjaxResult list() {
        return AjaxResult.success(iCourierCompanyService.listData());
    }

    /**
     * 添加修改
     * @param controller
     * @return
     */
    @PostMapping("addOrUp")
    public AjaxResult addOrUp(@RequestBody CourierCompany controller) {
        return AjaxResult.success(iCourierCompanyService.addOrUp(controller));
    }

    /**
     * 查询快递员工/总派送/消息数量
     */
    @GetMapping("number")
    public AjaxResult courierNumber(@RequestParam Integer companyId){
        return AjaxResult.success(iCourierCompanyService.courierNumber(companyId));
    }
}
